import { Router, Request, Response } from 'express';
import { TestController } from '../controllers/TestController';
import { asyncHandler } from '../utils/asyncHandler';

const router: Router = Router();
const testController = new TestController();

/**
 * @swagger
 * tags:
 *   name: Test Pages
 *   description: 测试页面相关路由
 */

/**
 * @swagger
 * /test:
 *   get:
 *     tags: [Test Pages]
 *     summary: 测试中心主页
 *     description: 显示测试中心主页，包含服务器状态和各功能测试入口
 *     responses:
 *       200:
 *         description: 成功显示测试页面
 *         content:
 *           text/html:
 *             schema:
 *               type: string
 */
router.get('/', asyncHandler(async (req: Request, res: Response) => {
  await testController.index(req, res);
}));

/**
 * @swagger
 * /test/api:
 *   get:
 *     tags: [Test Pages]
 *     summary: API测试页面
 *     description: 显示API功能测试页面，可以测试所有API端点
 *     responses:
 *       200:
 *         description: 成功显示API测试页面
 *         content:
 *           text/html:
 *             schema:
 *               type: string
 */
router.get('/api', asyncHandler(async (req: Request, res: Response) => {
  await testController.apiTest(req, res);
}));

/**
 * @swagger
 * /test/auth:
 *   get:
 *     tags: [Test Pages]
 *     summary: 认证测试页面
 *     description: 显示认证功能测试页面，包含JWT和Google OAuth测试
 *     responses:
 *       200:
 *         description: 成功显示认证测试页面
 *         content:
 *           text/html:
 *             schema:
 *               type: string
 */
router.get('/auth', asyncHandler(async (req: Request, res: Response) => {
  await testController.authTest(req, res);
}));

/**
 * @swagger
 * /test/payments:
 *   get:
 *     tags: [Test Pages]
 *     summary: 支付测试页面
 *     description: 显示支付功能测试页面，包含Stripe支付和订阅测试
 *     responses:
 *       200:
 *         description: 成功显示支付测试页面
 *         content:
 *           text/html:
 *             schema:
 *               type: string
 */
router.get('/payments', asyncHandler(async (req: Request, res: Response) => {
  await testController.paymentsTest(req, res);
}));

export default router; 